#coding=utf-8
from __future__ import unicode_literals

from django.db import models

# Create your models here.
class Users(models.Model):
	id=models.AutoField(primary_key=True)
	username=models.CharField(unique=True,max_length=20)
	password=models.CharField(max_length=20)
	identity=models.IntegerField()
	# 0表示学生 1表示教师 
	age=models.IntegerField(null=True)
	hobby=models.CharField(max_length=20,null=True)
	eduBackgroud=models.CharField(max_length=30,null=True)
	school=models.CharField(max_length=20,null=True)
	grade=models.CharField(max_length=10,null=True)
	reward=models.CharField(max_length=40,null=True)
	englishLevel=models.CharField(max_length=10,null=True)
	nickname=models.CharField(max_length=20,null=True)
	address=models.CharField(max_length=40,null=True)
	sex=models.CharField(max_length=4,null=True)
	contact=models.CharField(max_length=20,null=True)
	src = models.FileField(upload_to='header')
	
	class Meta:
		db_table='users'

class Lessons(models.Model):
	id=models.AutoField(primary_key=True)
	title=models.CharField(max_length=20)
	request=models.TextField()
	status=models.IntegerField()
	#0表示正在预约 1表示老师接受预约，2表示该订单已完成
	users=models.ForeignKey(Users,on_delete=models.CASCADE)
	class Meta:
		db_table='lessons'

# class UserHeader(models.Model):
# 	id = models.OneToOneField(Users,on_delete=models.CASCADE,primary_key=True)
# 	url = models.FileField(upload_to='header')
# 	class Meta:
# 		db_table='userheader'

class Teacherlesson(models.Model):
	# id=models.OneToOneField(Lessons,on_delete=models.CASCADE,primary_key=True)
	id=models.AutoField(primary_key=True)
	title=models.CharField(max_length=20)
	request=models.TextField()
	status=models.IntegerField()
	#0表示老师已接受预约，1表示该课程已完成
	users=models.ForeignKey(Users,on_delete=models.CASCADE)
	lessons=models.OneToOneField(Lessons,on_delete=models.CASCADE)
	class Meta:
		db_table='teacherlesson'
							
			

